<%@ include file="/view/template/header.jsp"%>	
	<div id="content">
    	<%@ include file="/view/ehr/ehr_common.jsp"%>
    	<script>
			$(function() {
				$("#tabs").tabs();
			});

		</script>
        <div class="right-content">
        <div class="box">
        	<s:if test='replyMessage.message!="empty"'>
					<h3><s:property value="replyMessage.message"/></h3>
			</s:if>
			<s:else>
				<s:if test="#parameters['ward_no'][0]!=0">
					<h1>
						<s:text name="label.admit.ward"/><s:property value="%{#parameters['ward_no'][0]}"/> 
						<s:text name="label.admit.bed"/> <s:property value="%{#parameters['bed_no'][0]}"/>
					</h1>
				</s:if>
				<s:else>
					<h1>
						<s:text name="label.admit.ward"/><s:property value="%{records.ward}"/> 
						<s:text name="label.admit.bed"/> <s:property value="%{records.bed}"/>
					</h1>
				</s:else>	
				<div id="tabs">
					<ul>
						<li><a href="#tabs-1"><s:text name="label.admit.admission_information"/></a>
						</li>
						<li><a href="#tabs-2"><s:text name="label.viewPatientDetails.other_patient_detials"/></a>
						</li>
						<li><a href="#tabs-3"><s:text name="label.viewPatientDetails.guardian_details"/></a>
						</li>
						<li><a href="#tabs-4"><s:text name="label.viewPatientDetails.medical_records"/></a>
						</li>
						<li><a href="#tabs-5"><s:text name="label.viewPatientDetails.drugs_prescribed"/></a>
						</li>
					</ul>
					<div id="tabs-1">
						<div class="sub_box">
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.patient_id"></s:label></span>
								<s:textfield key="changeConsultant.patient_id" value="%{records.patient_id}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.bht.consultant_id"></s:label></span>
								<s:textfield key="changeConsultant.new_consultant_id" value="%{records.bht.consultant_id}"/>
							</div>
							<div class="button_bar5">	
								<div class="con-part">
									<s:if test="#parameters['ward_no'][0]!=0">
										<s:url action="change_consultant" var="change_consultant_action">
											<s:param name="ward_no" value="%{#parameters['ward_no'][0]}"/>
											<s:param name="bed_no" value="%{#parameters['bed_no'][0]}"/>
											<s:param name="patient_id" value="%{records.patient_id}"/>
											<s:param name="current_consultant_id" value="%{records.bht.consultant_id}"/>
										</s:url>
									</s:if>
									<s:else>
										<s:url action="change_consultant" var="change_consultant_action">
											<s:param name="ward_no" value="%{records.ward}"/>
											<s:param name="bed_no" value="%{records.bed}"/>
											<s:param name="patient_id" value="%{records.patient_id}"/>
											<s:param name="current_consultant_id" value="%{records.bht.consultant_id}"/>
										</s:url>
									</s:else>
									<a href="${change_consultant_action}" class="green"><s:text name="label.change_Consultant.submit"/></a>
								</div>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.admission_date"></s:label></span>
								<s:textfield value="%{records.admission_date}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.admitting_officer"></s:label></span>
								<s:textfield value="%{records.admiting_officer}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.admit_reason"></s:label></span>
								<s:textfield value="%{records.admit_reason}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.admitted_bed"></s:label></span>
								<s:textfield value="%{records.bed}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.admitted_ward"></s:label></span>
								<s:textfield value="%{records.ward}" readonly="true"/>
							</div>
						</div>
					</div>
					<div id="tabs-2">
						<div class="sub_box">
							<div class="con-part">
								<span><s:label key="label.patient.patientName"></s:label></span>
								<s:textarea value="%{details.givenName}" readonly="true" cssClass="textareaStyle"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.patient.dob"></s:label></span>
								<s:textfield value="%{details.birthTime}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.patient.gender"></s:label></span>
								<s:textfield value="%{details.gender}" readonly="true"/>
							</div>
							
						</div>
					</div>
					<div id="tabs-3">
						<div class="sub_box">
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.guardian.prefix"></s:label></span>
								<s:textfield value="%{records.guardian.prefix}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.guardian.given_name"></s:label></span>
								<s:textfield value="%{records.guardian.given_name}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.guardian.furthur_names"></s:label></span>
								<s:textfield value="%{records.guardian.furthur_names}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.guardian.surname"></s:label></span>
								<s:textfield value="%{records.guardian.surname}" readonly="true"/>
							</div>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.guardian.nic_no"></s:label></span>
								<s:textfield value="%{records.guardian.nic_no}" readonly="true"/>
							</div>
							<s:if test="records.guardian.addresses.size > 0">
								<s:iterator value="records.guardian.addresses">
									<div class="con-part">
										<span><s:label key="label.viewPatientDetails.guardian.addresses.house_number"></s:label></span>
										<s:textfield value="%{house_number}" readonly="true"/>
									</div>
									<div class="con-part">
										<span><s:label key="label.viewPatientDetails.guardian.addresses.street"></s:label></span>
										<s:textfield value="%{street}" readonly="true"/>
									</div>
									<div class="con-part">
										<span><s:label key="label.viewPatientDetails.guardian.addresses.city_1"></s:label></span>
										<s:textfield value="%{city_1}" readonly="true"/>
									</div>
									<div class="con-part">
										<span><s:label key="label.viewPatientDetails.guardian.addresses.city_2"></s:label></span>
										<s:textfield value="%{city_2}" readonly="true"/>
									</div>
									<div class="con-part">
										<span><s:label key="label.viewPatientDetails.guardian.addresses.country"></s:label></span>
										<s:textfield value="%{country}" readonly="true"/>
									</div>
								</s:iterator>
							</s:if>
							<s:if test="records.guardian.telephoneNumbers.size > 0">
								<div class="con-part">
									<span><s:label key="label.viewPatientDetails.guardian.telephoneNumbers"></s:label></span>
									<s:iterator value="records.guardian.telephoneNumbers">
										<s:textfield value="%{records.guardian.telephoneNumbers}" readonly="true"/>
									</s:iterator>
								</div>
							</s:if>
							<s:if test="records.guardian.emails.size > 0">
								<div class="con-part">
									<span><s:label key="label.viewPatientDetails.guardian.email"></s:label></span>
									<s:iterator value="records.guardian.email">
										<s:textfield value="%{records.guardian.email}" readonly="true"/>
									</s:iterator>
								</div>
							</s:if>
							<div class="con-part">
								<span><s:label key="label.viewPatientDetails.guardian.guardian_relationship"></s:label></span>
								<s:textfield value="%{records.guardian.guardian_relationship}" readonly="true"/>
							</div>
						</div>
					</div>
					<div id="tabs-4">
						<div class="sub_box">
							<s:if test="records.medicalRecords.size > 0">
								<h1><s:text name="label.medicalRecords.observation_information"/></h1>
								<table border="1px" bordercolor="#0000FF">
									<tr>
										<td><span><s:label key="label.viewPatientDetails.medical_records.observation"></s:label></span></td>
										<td><span><s:label key="label.viewPatientDetails.medical_records.observerId"></s:label></span></td>
										<td><span><s:label key="label.viewPatientDetails.medical_records.observationdate"></s:label></span></td>
									</tr>
									<s:iterator value="records.medicalRecords">
										<s:if test='observation!=""'>
											<tr>
												<td><s:textarea value="%{observation}" readonly="true" cssClass="textareaStyle"/></td>
												<td><s:textfield value="%{observerId}" readonly="true" cssClass="textareaStyle"/></td>
												<td><s:textfield value="%{observationdate}" readonly="true" cssClass="textareaStyle"/></td>
											</tr>
										</s:if>
									</s:iterator>
							 	</table>
							 	<h1><s:text name="label.medicalRecords.diagosis_information"/></h1>
							 	<table border="1px" bordercolor="#0000FF">
							 		<tr>
										<td><span><s:label key="label.viewPatientDetails.medical_records.diagosis"></s:label></span></td>
										<td><span><s:label key="label.viewPatientDetails.medical_records.diagnosingClinicianId"></s:label></span></td>
										<td><span><s:label key="label.viewPatientDetails.medical_records.diagnosingDate"></s:label></span></td>
									</tr>
									<s:iterator value="records.medicalRecords">
										<s:if test='diagosis!=""'>
											<tr>
												<td><s:textarea value="%{diagosis}" readonly="true" cssClass="textareaStyle"/></td>
												<td><s:textfield value="%{diagnosingClinicianId}" readonly="true" cssClass="textareaStyle"/></td>
												<td><s:textfield value="%{diagnosingDate}" readonly="true"cssClass="textareaStyle"/></td>
											</tr>
										</s:if>
									</s:iterator>
							 	</table>
						 	</s:if>
							<div class="con-part">
								<s:url action="add_health_records" var="add_health_records_action">
									<s:param name="patient_id" value="%{records.patient_id}"/>
								</s:url>
								<a href="${add_health_records_action}" class="green"><s:text name="label.viewPatientDetails.medical_records.add_new_medical_records"/></a>
							</div>
						</div>
					</div>
					<div id="tabs-5">
						<div class="sub_box">
							<s:if test='message.message!="empty"'>
								<h3><s:property value="message.message" /></h3>
							</s:if>
							<s:else>
							<s:if test="prescriptionDrugsList.size > 0">
					<table border="1px" bordercolor="#0000FF">
						<tr>
							<td><span><s:label key="prescribeDrugs1.patientId"></s:label></span></td>
							<td><span><s:label key="prescribeDrugs1.drugId"></s:label></span></td>
							<td><span><s:label key="prescribeDrugs1.drugName"></s:label></span></td>
							<td><span><s:label key="prescribeDrugs1.dosage"></s:label></span></td>
							<td><span><s:label key="prescriptionDrugs.minAmount"></s:label></span></td>
							<td><span><s:label key="prescriptionDrugs.maxAmount"></s:label></span></td>
							<td><span><s:label key="prescriptionDrugs.amountUnits"></s:label></span></td>
							<td><span><s:label key="prescribeDrugs1.dispensedquantity"></s:label></span></td>
							<td><span><s:label key="prescribeDrugs1.dispenseDate"></s:label></span></td>
						</tr>
						
						<s:iterator value="prescriptionDrugsList">
						
						<tr>
							<td><s:textfield value="%{patientId}" readonly="true" cssClass="textfieldStyleSmall"/></td>
							<td><s:textfield value="%{drugId}" readonly="true" cssClass="textfieldStyleSmall"/></td>
							<td><s:textarea value="%{drugName}" readonly="true" cssClass="textareaStyleSmall"/></td>
							<td><s:textarea value="%{dosage}" readonly="true" cssClass="textareaStyleSmall"/></td>
							<td><s:textfield value="%{minAmount}" readonly="true" cssClass="textfieldStyleSmall"/></td>
							<td><s:textfield value="%{maxAmount}" readonly="true" cssClass="textfieldStyleSmall"/></td>
							<td><s:textfield value="%{dispenceUnits}" readonly="true" cssClass="textfieldStyleSmall"/></td>
							<td><s:textfield value="%{dispencedQuantity}" readonly="true" cssClass="textfieldStyleSmall"/></td>
							<td><s:textfield value="%{requestDate}" readonly="true" cssClass="textfieldStyleDate"/></td>
						</tr>
						</s:iterator>
					</table>
					</s:if>
						
					</s:else>
					<div class="button_bar2">
							<div class="con-part">
								<s:url action="prescription_drugs" var="prescription_drugs_action" >
									<s:param name="patient_id" value="%{records.patient_id}"/>
								</s:url>
								<a href="${prescription_drugs_action}" class="green"><s:text name="menu.supply_chain.prescription_drugs"/></a>
							</div>
						</div>	
						</div>
					</div>
					<div class="button_bar2">
						<s:if test="records.no_of_Admssions > 0">
						<div class="con-part">
							<s:if test="#parameters['ward_no'][0]!=0">
								<s:url action="view_past_admissions" var="view_past_admissions_action">
									<s:param name="ward_no" value="%{#parameters['ward_no'][0]}"/>
									<s:param name="bed_no" value="%{#parameters['bed_no'][0]}"/>
									<s:param name="patient_id" value="%{records.patient_id}"/>
								</s:url>
							</s:if>
							<s:else>
								<s:url action="view_past_admissions" var="view_past_admissions_action">
									<s:param name="ward_no" value="%{records.ward}"/>
									<s:param name="bed_no" value="%{records.bed}"/>
									<s:param name="patient_id" value="%{records.patient_id}"/>
								</s:url>
							</s:else>
							<a href="${view_past_admissions_action}" class="green"><s:text name="label.viewPatientDetails.past_admissions"/></a>
						</div>
						</s:if>
						<s:else>
							<s:text name="label.viewPatientDetails.no_past_admissions"/>
						</s:else>
						<div class="con-part">
							<s:if test="#parameters['ward_no'][0]!=0">
								<s:url action="discharge_patient" var="discharge_patient_action">
									<s:param name="patient_id" value="%{records.patient_id}"/>
									<s:param name="ward_no" value="%{#parameters['ward_no'][0]}"/>
									<s:param name="bed_no" value="%{#parameters['bed_no'][0]}"/>
								</s:url>
							</s:if>
							<s:else>
								<s:url action="discharge_patient" var="discharge_patient_action">
									<s:param name="patient_id" value="%{records.patient_id}"/>
									<s:param name="ward_no" value="%{records.ward}"/>
									<s:param name="bed_no" value="%{records.bed}"/>
								</s:url>
							</s:else>
							<a href="${discharge_patient_action}" class="green"><s:text name="label.dischargePatient.dischargeTitle"/></a>
						</div>
						</div>
						<div class="button_bar2">
						<div class="con-part">
							<s:if test="#parameters['ward_no'][0]!=0">
								<s:url action="transfer_patient" var="transfer_patient_action">
									<s:param name="patient_id" value="%{records.patient_id}"/>
									<s:param name="ward_no" value="%{#parameters['ward_no'][0]}"/>
									<s:param name="bed_no" value="%{#parameters['bed_no'][0]}"/>
								</s:url>
							</s:if>
							<s:else>
								<s:url action="transfer_patient" var="transfer_patient_action">
									<s:param name="patient_id" value="%{records.patient_id}"/>
									<s:param name="ward_no" value="%{records.ward}"/>
									<s:param name="bed_no" value="%{records.bed}"/>
								</s:url>
							</s:else>
							<a href="${transfer_patient_action}" class="green"><s:text name="label.transferToAnotherWard.title"/></a>
						</div>
						<div class="con-part">
							<s:if test="#parameters['ward_no'][0]!=0">
								<s:url action="transfer_to_another_hospital" var="transfer_to_another_hospital_action">
									<s:param name="patient_id" value="%{records.patient_id}"/>
									<s:param name="ward_no" value="%{#parameters['ward_no'][0]}"/>
									<s:param name="bed_no" value="%{#parameters['bed_no'][0]}"/>
								</s:url>
							</s:if>
							<s:else>
								<s:url action="transfer_to_another_hospital" var="transfer_to_another_hospital_action">
									<s:param name="patient_id" value="%{records.patient_id}"/>
									<s:param name="ward_no" value="%{records.ward}"/>
									<s:param name="bed_no" value="%{records.bed}"/>
								</s:url>
							</s:else>
							<a href="${transfer_to_another_hospital_action}" class="green"><s:text name="label.transferToAnotherHospital.title"/></a>
						</div>
					</div>
				</div>
			</s:else>
			</div>
		</div>
	</div>
<%@ include file="/view/template/footer.jsp"%>
